package main
import (
	"fmt"
)
type Usb interface{
	start()
	stop()
}



type Phone struct{
	Name string
}
func (p Phone) start(){
	fmt.Printf("%s start!!!\n",p.Name)
}
func (p Phone)stop(){
	fmt.Printf("%s stop!!!\n",p.Name)
}

type Camera struct{
	Name string
}
func (c Camera)start(){
	fmt.Printf("%s start\n",c.Name)
}
func (c Camera)stop(){
	fmt.Printf("%s stop\n",c.Name)
}
func (c Camera)test(){
	fmt.Printf("test...\n")
}
type Computer struct{

}


func (c Computer)work(us Usb){
	us.start()
	us.stop()
}


func main(){
	phone:=Phone{Name:"华为手机"}
	var us1 Usb=phone
	us1.start()
	us1.stop()
	fmt.Printf("type:%T\n",us1)
	camera:=Camera{Name:"索尼相机"}
	us1 =camera
	us1.start()
	us1.stop()
	fmt.Printf("type:%T\n",us1)
	camera.test()
	//us2.test()
	fmt.Printf("-----------------------\n")
	var c Computer
	c.work(phone)
	c.work(camera)
}